const path = require('path');
const HTMLWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
module.exports = {
    // 入口文件，程序主文件
    entry: './src/index.js', // 打包文件
    output: {
        path: path.resolve(__dirname, 'dist'), filename: 'bundle.js',
    }, // 打包时需要的模块
    module: {
        rules: [{
            // test指定的是规则生效的文件
            test: /\.ts$/, use: 'ts-loader', exclude: /node_modules/
        }]
    }, plugins: [new CleanWebpackPlugin(), new HTMLWebpackPlugin({
        template: 'src/index.html', title: "Webpack Application"
    }),],

    resolve: {
        extensions: ['.ts', '.js', '.css', '.html', '.css?$/i'],
    }
}